cmake_minimum_required(VERSION 2.8.12)
project(design-patterns)
if (${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    message(FATAL_ERROR "
        FATAL:In-source builds are not allowed.
        You should create a separate directory for build files.
        致命错误：不能在源码文件夹执行cmake命令。
        你必须单独创建一个用于构建的文件夹，然后重新执行cmake命令
    ")
endif ()

# 输出文件夹
set(BUILD_TOP_DIR "${PROJECT_SOURCE_DIR}/build" CACHE INTERNAL "BUILD_TOP_DIR")

# 编译工具库
add_subdirectory(./utils)

# 添加各个设计模式的文件夹
add_subdirectory(./template-method)
add_subdirectory(./strategy)
add_subdirectory(./observer)
add_subdirectory(./decorator)
add_subdirectory(./bridge)
add_subdirectory(./simple-factory)
add_subdirectory(./factory-method)
add_subdirectory(./abstract-factory)
add_subdirectory(./prototype)
add_subdirectory(./builder)
add_subdirectory(./singleton)
add_subdirectory(./flyweight)
add_subdirectory(./facade)
add_subdirectory(./proxy)
add_subdirectory(./adapter)
add_subdirectory(./mediator)
add_subdirectory(./state)
add_subdirectory(./memento)
add_subdirectory(./composite)
add_subdirectory(./iterator)
add_subdirectory(./chain-of-responsibility)

set(CMAKE_CXX_STANDARD 17)